package com.rt.tmpt.others.jpush;
/*
import cn.jiguang.common.ClientConfig;
import cn.jiguang.common.resp.APIConnectionException;
import cn.jiguang.common.resp.APIRequestException;
import cn.jpush.api.JPushClient;
import cn.jpush.api.push.PushResult;
import cn.jpush.api.push.model.Platform;
import cn.jpush.api.push.model.PushPayload;
import cn.jpush.api.push.model.audience.Audience;
import cn.jpush.api.push.model.notification.Notification;*/

/**
 * Created by wxy on 2017/11/15.
 */
public class JpushUtils {
    static String MASTER_SECRET = "f548dc1bffe03f4a67122647";
    static String APP_KEY = "d318aab69ed5e6c096bcf546";

    /*public static void push(List<String> tagList, String ALERT){
        try {
            if(tagList==null || tagList.isEmpty())return;

            LOG.info("===>jpush:"+ALERT+" : "+tagList);
            JPushClient jpushClient = new JPushClient(MASTER_SECRET, APP_KEY, null, ClientConfig.getInstance());
            PushPayload payload = buildPushObject_android_alias_alert(tagList, ALERT);
            PushResult result = jpushClient.sendPush(payload);
            LOG.info("Got result - " + ":" + result);

        } catch (APIConnectionException e) {
            // Connection error, should retry later
            LOG.error("Connection error, should retry later", e);

        } catch (APIRequestException e) {
            // Should review the error, and fix the request
            LOG.error("Should review the error, and fix the request", e);
            LOG.info("HTTP Status: " + e.getStatus());
            LOG.info("Error Code: " + e.getErrorCode());
            LOG.info("Error Message: " + e.getErrorMessage());
        }
    }

    public static PushPayload buildPushObject_all_all_alert() {
        return PushPayload.alertAll("dddddddddd");
    }

    public static PushPayload buildPushObject_android_alias_alert(List<String> aliasList, String ALERT) {
        return PushPayload.newBuilder()
                .setPlatform(Platform.all())
                .setAudience(Audience.alias(aliasList))
                .setNotification(Notification.alert(ALERT))
                .build();
    }

    public static void main(String[] args) {
        List<String> tagList = new ArrayList<>();
        tagList.add("1");
        tagList.add("24");
        JpushUtils.push(tagList, "ALERT111");
    }*/

}
